/* 和部门相关的接口信息 */
import request from './request.js'

/* 获取列表条数 */
export async function getDepartListCounter() {
    let url = '/depart';
    return await request.get(url);
}

/* 部门列表相关的接口 */
export async function getDepartList({ page, limit }) {
    let url = '/depart';
    return await request.get(url, {
        params: {
            _page: page,
            _limit: limit
        }
    });
}
export async function getDepart() {
    let url = '/depart';
    return await request.get(url);
}

/* 部门删除接口 */
export async function deleteDepart(id) {
    let url = '/depart' + '/' + id;
    await request.delete(url);
}

/* 添加部门信息接口 */
export async function addDepart({ name, tel }) {
    let url = '/depart';
    await request.post(url, { name, tel });
}

/* 修改部门信息接口 */
export async function updateDepartMsg(id, name, tel) {
    let url = '/depart' + '/' + id;
    if (name) {
        await request.patch(url, { name });
    }
    if (tel) {
        await request.patch(url, { tel });
    }
}